#include <stddef.h>
#include <stdio.h>
#include <time.h>

size_t compact_non_zero(size_t n, const int* in, int* out);

int main()
{
	int n = 16, m;
	int in[128], out[128];

	printf("in:\t");
	for(int i = 0; i < n; i ++)
	{
		in[i] = (rand() % 2) ? i + 1 : 0;
		printf("%d\t", in[i]);
	}
	puts("");

	m = compact_non_zero(n, in, out);

	puts("\n-------------------------------------------\n");
	printf("out:\t");
	for(int i = 0; i < m; i ++) printf("%d\t", out[i]);
	puts("");

	return 0;
}
